package com.xtwy.repository;

import com.xtwy.entity.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.lang.annotation.Native;
import java.util.List;
import java.util.Map;

/**
 * @作 者: 侯建军
 * @日 期: 2018/7/28 20:09
 * @描 述: 角色dao
 * @公 司：山西迅腾伟业
 */
@Repository
public interface RoleRepository extends JpaRepository<Role, Long> {
        @Query(nativeQuery = true,value = "SELECT r.id as roleid FROM t_role r,t_user u,t_user_role ur " +
                " WHERE r.id=ur.role_id and u.id=ur.user_id and u.username=?1")
        List<Integer> findByUsername(String username);

}
